import App from './App'
import store from '@/store';

import uView from "uview-ui";
import uniPopup from "./uni_modules/uni-popup/components/uni-popup/uni-popup.vue";

Vue.use(uView);
Vue.component("popupCom", uniPopup);

let vuexStore = require("@/store/$u.mixin.js");
Vue.mixin(vuexStore);

// 日期过滤器
Vue.filter('dateFormat', function(value, fmt) {
	if (value) {
		let getDate = new Date(value);
		let o = {
			'M+': getDate.getMonth() + 1,
			'd+': getDate.getDate(),
			'h+': getDate.getHours(),
			'm+': getDate.getMinutes(),
			's+': getDate.getSeconds(),
			'q+': Math.floor((getDate.getMonth() + 3) / 3),
			'S': getDate.getMilliseconds()
		};
		if (/(y+)/.test(fmt)) {
			fmt = fmt.replace(RegExp.$1, (getDate.getFullYear() + '').substr(4 - RegExp.$1.length))
		}
		for (let k in o) {
			if (new RegExp('(' + k + ')').test(fmt)) {
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
			}
		}
	} else {
		return '-';
	}
	return fmt;
});

Vue.prototype.$imgsUrl = function(uri) {
	return `http://jinzhuangli.oss-cn-guangzhou.aliyuncs.com/staticFile/images/${uri}.png`;
};

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App,
	store
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app,
		store
	}
}
// #endif